<?php
/*
 *  Created by Andrew J. Bennieston on 2007-03-07.
 *  Copyright (c) 2007. All rights reserved.
 */

class DBFactory
{
	const DB_MYSQL = 1;
	const DB_PGSQL = 2;
	const DB_MSSQL = 3;
	const DB_MSQL = 4;
	const DB_SQLITE = 5;
	
	public static function create($type, $dbname, $host = NULL, $user = NULL, $password = NULL, $port = NULL)
	{
		$db = NULL;
		switch($type)
		{
			case DB_MYSQL:
				$db = new MySQL($dbname, $host, $user, $password, $port);
				break;
			case DB_PGSQL:
				$db = new PostgreSQL($dbname, $host, $user, $password, $port);
				break;
			case DB_MSSQL:
				$db = new MSSQL($dbname, $host, $user, $password, $port);
				break;
			case DB_MSQL:
				$db = new mSQL($dbname, $host, $user, $password, $port);
				break;
			case DB_SQLITE:
				$db = new SQLite($dbname, $host, $user, $password, $port);
				break;
			default:
				break;
		}
		return $db;
	}
}

?>